package by.pavlyukevich.paymentsystem.services.user.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import by.pavlyukevich.paymentsystem.dataaccess.filter.UserAccountFilter;
import by.pavlyukevich.paymentsystem.dataaccess.user.impl.UserAccountDaoImpl;
import by.pavlyukevich.paymentsystem.datamodel.user.UserAccount;
import by.pavlyukevich.paymentsystem.services.impl.AbstractServiceImpl;
import by.pavlyukevich.paymentsystem.services.user.UserAccountService;

@Service
public class UserAccountServiceImpl extends
		AbstractServiceImpl<Integer, UserAccount, UserAccountDaoImpl> implements UserAccountService {

	@Override
	public UserAccount getUserByLogin(String login) {
		List<UserAccount> userAccountsList = dao.getList(new UserAccountFilter().setLogin(login));
		if (userAccountsList.size() == 1) {
			return userAccountsList.get(0);
		}
		return null;
	}

}
